package com.itheima.dianming.exception;

import com.itheima.dianming.pojo.vo.R;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Component
@RestControllerAdvice
public class ExceptionAdvice {

    @ExceptionHandler(BusinessException.class)
    public R handleBusinessException(BusinessException businessException){
        return R.onflag(false,businessException.getMessage());
    }
}
